﻿using System.Security.Principal;
using System.Web;

namespace Mvc3Demo.Test.WebCore
{
    public class HttpContextStub : HttpContextBase
    {
        private readonly IPrincipal _user = new GenericPrincipal(new GenericIdentity("someUser"), null /* roles */);

        private readonly HttpRequestBase _httpRequestBase = new HttpRequestBaseStub();

        private readonly HttpResponseBase _httpResponse = new HttpResponseStub();

        private readonly HttpSessionStateBase _session = new HttpSessionStateBaseStub();

        public override IPrincipal User
        {
            get
            {
                return _user;
            }
            set
            {
                base.User = value;
            }
        }

        public override HttpRequestBase Request
        {
            get
            {
                return _httpRequestBase;
            }
        }

        public override HttpResponseBase Response
        {
            get
            {
                return _httpResponse;
            }
        }

        public override HttpSessionStateBase Session
        {
            get
            {
                return _session;
            }
        }
    }
}